<template>
  <div lang=ZH-CN style='text-align:center'>
    <div id="jbxx" style="width:790px;margin:auto;" ref="print">
      <jbxxTemplate></jbxxTemplate>
    </div>
    <div class="error500-btn-con">
      <el-button @click="myprint" style="width: 200px;margin-top:10px" type='primary'>打印</el-button>
    </div>
  </div>
</template>
<script>
import html2canvas from 'html2canvas'
import { getObj } from '@/api/cust/base'
import jbxxTemplate from './jbxxTemplate'
import { getStore } from '@/util/store.js'
import '@/styles/report.scss'
export default {
  components: {
    jbxxTemplate
  },
  data() {
    return {
      loading: false,
      grjbxxid: this.$route.query.grjbxxid
    }
  },
  created() {},
  mounted() {},
  methods: {
    myprint() {
      // this.loading = true
      // this.$message.success('后台正在打包,请稍候。。。')
      // var dom = document.getElementById('jbxx')
      // html2canvas(dom).then(canvas => {
      //   const url = canvas.toDataURL()
      //   var newstr = `<img src="${url}" width="100%"/>`
      //   var tab = window.open('', '打印')
      //   tab.document.open()
      //   tab.document.write(newstr)
      //   setTimeout(() => {
      //     tab.window.print()
      //     tab.close()
      //     this.loading = false
      //   }, 0)
      // })
      this.$print(this.$refs.print)
    },
    breaks() {}
  },
  computed: {},
  props: []
}
</script>

